# -*- encoding=utf8 -*-
"""
RedFlag-TC0000113  特效视频条播放及滑动用例
①进入特效场景
②取消返回装饰页场景
③特效播放场景
④特效暂停场景
⑤特效播放完成时间确认场景
⑥左右滑动特效片段场景
"""
__author__ = "ldm"

import sys
import os

# 获取当前脚本所在目录.py
current_dir = os.path.dirname(os.path.abspath(__file__))
# 获取上级目录.air
parent_dir = os.path.dirname(current_dir)
# 获取上级目录air
grandparent_dir = os.path.dirname(parent_dir)
# 获取和air目录平级的conf、testcase目录路径
conf_dir = os.path.join(grandparent_dir, 'conf')
testcase_dir = os.path.join(grandparent_dir, 'testcase')
# 将conf、testcase目录添加到sys.path
sys.path.append(conf_dir)
sys.path.append(testcase_dir)

from PageFunction import CameraVideoShooter
from elements import *

auto_setup(__file__)
shooter = CameraVideoShooter()

log("--------------------------------进入特效场景--------------------------------------")
"""
拍摄视频进入装饰页
点击特效
断言
"""

shooter.enter_photography_decoration_page()
shooter.click_element(decoration_page_special_effects)
shooter.assert_element_exists(poco("cn.migu.video.clip.walle:id/ll_add"), "断言成功，预期特效title出现")


log("--------------------------------取消返回装饰页场景--------------------------------------")
"""
拍摄视频进入装饰页
点击特效
点击取消
断言
"""

shooter.click_element(decoration_page_special_effects_cancel)
shooter.assert_element_exists(poco("cn.migu.video.clip.walle:id/walle_ugc_clip_rbt_iv"), "断言成功，预期特效title出现")


log("--------------------------------特效播放场景--------------------------------------")
"""
拍摄视频进入装饰页
点击特效
点击播放
断言
"""

shooter.click_element(decoration_page_special_effects)
shooter.click_element(decoration_page_special_effects_play)
shooter.assert_element_exists(poco("cn.migu.video.clip.walle:id/tv_save"),"断言成功，预期特效title出现")


log("--------------------------------特效暂停场景--------------------------------------")
"""
拍摄视频进入装饰页
点击特效
点击播放
点击暂停
断言
"""

shooter.click_element(decoration_page_special_effects_play)
shooter.assert_element_exists(poco("cn.migu.video.clip.walle:id/tv_save"),"断言成功，预期特效title出现")


log("--------------------------------播放完成时间确认场景--------------------------------------")
"""
拍摄视频进入装饰页
点击特效
点击播放
播放完成时间确认
断言
"""

shooter.click_element(decoration_page_special_effects_play)
shooter.click_element(decoration_page_special_effects_total_time)
shooter.assert_element_exists(poco("cn.migu.video.clip.walle:id/tv_cancel"),"断言成功，预期特效title出现")


log("--------------------------------添加特效后取消不保留再次点击特效查看场景--------------------------------------")
"""
拍摄视频进入装饰页
点击特效
点击播放
点击添加
选择特效点击✓
点击取消不保留
点击特效git push
断言
"""

shooter.click_element(decoration_page_special_effects_play)
shooter.click_element(decoration_page_special_effects_add)
shooter.click_element(decoration_page_special_effects_panel_fairy)
shooter.click_element(decoration_page_special_effects_panel_fairy)
shooter.click_element(decoration_page_special_effects_panel_confirm)
shooter.click_element(decoration_page_special_effects_cancel)
shooter.click_element(decoration_page_special_effects_not_retain)
shooter.click_element(decoration_page_special_effects)
shooter.assert_element_exists(poco("cn.migu.video.clip.walle:id/ll_add"), "断言成功，预期特效title出现")

# 关闭应用
stop_app(UGC_package_name)
